package kr.saeildamil.androidstudy.ch19;

import kr.saeildamil.androidstudy.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class RunnableTestt extends Activity {

	int mMainValue;
	int mBackValue;
	TextView MainValueTv;
	TextView BackValueTv;

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch19_threadtestt);
		
		MainValueTv = (TextView) findViewById(R.id.ch19_threadtest_mainvalue);
		BackValueTv = (TextView) findViewById(R.id.ch19_threadtest_backvalue);

		Thread thread = new Thread(new Runnable() {
			public void run() {
				while (true) {
					mBackValue++;
					try {
						Thread.sleep(10);
					} catch (InterruptedException e) {
					}
				}
			}
		});
		thread.start();
	}// end of method onCreate();

	public void mOnClick(View v) {
		mMainValue++;
		MainValueTv.setText("MAIN VALUE : " + mMainValue);
		BackValueTv.setText("BACK VALUE : " + mBackValue);
	}// end of method mOnClick()
}
